| Conditions | 6 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | function docoptKey(key) { |
||
| 13 | export function buildDocoptParams(opts, { include, exclude } = {}) { |
||
| 14 | const clean = {}; |
||
| 15 | const filtered = Object.keys(opts) |
||
| 16 | .map(raw => ({ raw, key: docoptKey(raw) })) |
||
| 17 | .filter( |
||
| 18 | ({ key }) => |
||
| 19 | (include ? include.includes(key) : true) |
||
| 20 | && (exclude ? !exclude.includes(key) : true) |
||
| 21 | ); |
||
| 22 | |||
| 23 | for (const { raw, key } of filtered) { |
||
| 24 | clean[key] = opts[raw]; |
||
| 25 | } |
||
| 26 | |||
| 27 | return clean; |
||
| 28 | } |
||
| 29 |